<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        // 数组
        let arr1 = [1,3,5,7]
        let arr2 = [2,4,6,8]
        // 解构
        console.log(...arr1);
        // 合并
        console.log(...arr1,...arr2);

        // 函数
        function sum(...numbers) {
            console.log('@',numbers);
            return numbers.reduce((preVlaue,currentValue) => {
                return preVlaue + currentValue
            })
        }
        console.log(sum(1,2,3,4,5));
        console.log(sum([1,2,3]));


        let obj = {a:1,b:2}
        // 展开运算符不能展开对象，但可以复制/合并对象
        // console.log(...obj); //Found non-callable @@iterator
        let obj2 = {...obj,c:1}
        console.log(obj2);
    </script>
</body>
</html>